import {commGet} from "@utils/service/index.js";

/**
 * 获取退款记录
 * @param data {object} 请求参数
 * @returns {Promise<* extends (object & {then(onfulfilled: infer F, ...args: infer _): any}) ? (F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never) : *>}
 */
export function getRefundHistory(data) {
    return commGet({
        url: `/order/refund/history`,
        method: 'get',
        data
    })
}

/**
 * 获取退款详情
 * @param data {object} 请求参数
 * @returns {Promise<* extends (object & {then(onfulfilled: infer F, ...args: infer _): any}) ? (F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never) : *>}
 */
export function getRefundInfo(data) {
    return commGet({
        url: `/order/refund/info`,
        method: 'get',
        data
    })
}

/**
 * 计算退款金额
 * @param data {object} 请求参数
 * @returns {Promise<* extends (object & {then(onfulfilled: infer F, ...args: infer _): any}) ? (F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never) : *>}
 */
export function getRefundCompute(data) {
    return commGet({
        url: `/order/refund/compute`,
        method: 'post',
        data
    })
}

/**
 * 申请退款
 * @param data {object} 请求参数
 * @returns {Promise<* extends (object & {then(onfulfilled: infer F, ...args: infer _): any}) ? (F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never) : *>}
 * @constructor
 */
export function RefundRequest(data) {
    return commGet({
        url: `/order/refund/request`,
        method: 'post',
        data
    })
}
